from django import template
from l2ldjango.apps.personalblog.models import *
from l2ldjango.apps.usermanagement.models import *


def getpost():
	posts=PersonalBlog.objects.filter(status=3,visible_to_all=1).order_by("-creation_date")[:1]
	return {'posts':posts}

def getuserinfo(userid):
	try:
		usr=userprofile.objects.get(user_id=userid)
		return {'usr':usr}

	except:
		usr=''
		return {'usr':usr}

register = template.Library()
register.inclusion_tag('personalblog/get_latestpost.html')(getpost)
register.inclusion_tag('user/get_userinfo.html')(getuserinfo)


